package com.java3_8;

//饿汉单例模式
public class Demo1 {
    private String name;
    private int age;

    //私有化构造器
    private Demo1(String name,int age){
        this.name = name;
        this.age = age;
    }

    //创建对象
    private static Demo1 demo1 = new Demo1("zhangsan", 20);

    //使用方法将其展现
    public static Demo1 getDemo1(){
        return demo1;
    }


}
